﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MODEL;
using GalaSoft.MvvmLight.Messaging;
using GalaSoft.MvvmLight;

namespace msap.Agriculture.Search
{
    /// <summary>
    /// Index.xaml 的交互逻辑
    /// </summary>
    public partial class Index : Page
    {
        public Index()
        {
            InitializeComponent();
            Messenger.Default.Register<ViewModelBase>(this, "Agriculture_ShowInfoForm", true, ShowInfoWindow);
            Messenger.Default.Register<ViewModelBase>(this, "Agriculture_EditInfoForm", true, EditInfoWindow);
        }

        private void ShowInfoWindow(ViewModelBase vm)
        {
            AgricultureInfoForm infoForm = new AgricultureInfoForm();
            infoForm.DataContext = vm;
            infoForm.Owner = Window.GetWindow(this);
            infoForm.ShowDialog();
        }
        private void EditInfoWindow(ViewModelBase vm)
        {
            EditInfoForm EditinfoForm = new EditInfoForm();
            EditinfoForm.DataContext = vm;
            EditinfoForm.Owner = Window.GetWindow(this);
            EditinfoForm.ShowDialog();
        }
    }
}
